TreeSelect 分类选择
更新时间:2022-02-16
TreeSelect 分类选择
TreeSelect 分类选择
属性说明:
属性名 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
selectTitle | String | 无 | 是 | 折叠面板 title |
content | String | 无 | 否 | 折叠面板内容 |
adapter | Array | 无 | 否 | 将初始值转化为含有 id、name、total 的值,数组 index 对应 tree 层级 |
bindchange | Function | 无 | 否 | 切换状态时的回调 |
示例:
json:
{
"navigationBarTitleText": "侧边导航-Sidebar",
"usingComponents": {
"iov-tree-select": "iov-ui/lib/tree-select"
}
}
swan:
<view class="collapse-demo">
<view class="collapse-demo-box">
<iov-tree-select
selectTitle="树形选择"
content="{{ content }}"
bindchange="change"
adapter="{{ adapter }}"
></iov-tree-select>
</view>
</view>
js:
import tradearea from './tradearea.json';
Page({
data: {
content: tradearea.area,
adapter: [
{id: 'areaid', name: 'areaname', total: 'hotelnum'},
{id: 'id', name: 'businessdistrict', total: 'hotelnum'},
{id: 'id', name: 'businessdistrict', total: 'hotelnum'}
]
},
change: function (e) {
console.log('>> select value changed', e.value);
}
});
tradearea.json:
// tradearea.json 示例
{
"area": [
{
"areaid": "95",
"areaname": "\u623f\u5c71\u533a",
"hotelnum": "1680",
"list": [
{
"businessdistrict": "\u623f\u5c71\u98ce\u666f\u533a",
"hotelnum": "1680",
"list": [
{
"businessdistrict": "\u623f\u5c71\u98ce\u666f\u533a\u666f\u533a",
"hotelnum": "16"
}
]
}
]
}
]
}